package com.market.plus.core.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@Table(name = "CONTENTFILE")
@NamedQueries( { @NamedQuery(name = ContentFile.FIND_GUIDS, query = "SELECT file FROM ContentFile file where file.guid in (:fileGUIDs)") })
public class ContentFile implements Persistable, StatusInfo, ModifyedInfo {

   public static final String FIND_GUIDS = "CONTENTFILE.FIND_GUIDS";
   
   public static final String PARA_GUIDS = "fileGUIDs";

   @Id
   @GeneratedValue(strategy = GenerationType.TABLE, generator = "GEN_CONTENTFILE")
   @TableGenerator(name = "GEN_CONTENTFILE", table = "SEQUENCE_LIST", allocationSize = 1, initialValue = 1, pkColumnName = "NAME", valueColumnName = "NEXT_SEQUENCE", pkColumnValue = "CONTENTFILE")
   @Column(name = "CONTENTFILE_ID")
   private Long id;

   @Column(name = "CONTENTFILEGUID", unique = true, nullable = false)
   private String guid;

   @Column(name = "CURRENTVERSION")
   private Float currentVersion;

   @Column(name = "TOOLTIP")
   private String tooltip;

   @Column(name = "LASTVERSION")
   private Float lastVersion;

   @Column(name = "CREATED_USER")
   private String createdUser;

   @Column(name = "CREATED_DATE")
   private Date createdDate;

   @Column(name = "MODIFYED_USER")
   private String modifyedUser;

   @Column(name = "MODIFYED_DATE")
   private Date modifyedDate;

   @Column(name = "STATUS")
   @Enumerated(EnumType.ORDINAL)
   private Status status;

   @Column(name = "FileName")
   private String fileName;

   @Column(name = "MINETYPE")
   private String mineType;

   @Column(name = "LENGTHFILE")
   private Long lengthFile;

   public ContentFile() {
   }

   public Long getId() {
      return id;
   }

   public void setId(Long id) {
      this.id = id;
   }

   public Float getCurrentVersion() {
      return currentVersion;
   }

   public void setCurrentVersion(Float currentVersion) {
      this.currentVersion = currentVersion;
   }

   public Float getLastVersion() {
      return lastVersion;
   }

   public void setLastVersion(Float lastVersion) {
      this.lastVersion = lastVersion;
   }

   public Status getStatus() {
      return status;
   }

   public void setStatus(Status status) {
      this.status = status;
   }

   public String getCreatedUser() {
      return createdUser;
   }

   public void setCreatedUser(String createdUser) {
      this.createdUser = createdUser;
   }

   public Date getCreatedDate() {
      return createdDate;
   }

   public void setCreatedDate(Date createdDate) {
      this.createdDate = createdDate;
   }

   public String getModifyedUser() {
      return modifyedUser;
   }

   public void setModifyedUser(String modifyedUser) {
      this.modifyedUser = modifyedUser;
   }

   public Date getModifyedDate() {
      return modifyedDate;
   }

   public void setModifyedDate(Date modifyedDate) {
      this.modifyedDate = modifyedDate;
   }

/*   public Participant getParticipant() {
      return participant;
   }

   public void setParticipant(Participant participant) {
      this.participant = participant;
   }*/

   public String getGuid() {
      return guid;
   }

   public void setGuid(String guid) {
      this.guid = guid;
   }

   public String getFileName() {
      return fileName;
   }

   public void setFileName(String fileName) {
      this.fileName = fileName;
   }

   public String getMineType() {
      return mineType;
   }

   public void setMineType(String mineType) {
      this.mineType = mineType;
   }

   public Long getLengthFile() {
      return lengthFile;
   }

   public void setLengthFile(Long lengthFile) {
      this.lengthFile = lengthFile;
   }

/*   public Tribe getTribe() {
      return tribe;
   }

   public void setTribe(Tribe tribe) {
      this.tribe = tribe;
   }*/

   public String getTooltip() {
      return tooltip;
   }

   public void setTooltip(String tooltip) {
      this.tooltip = tooltip;
   }

   @Override
   public boolean equals(Object obj) {
      ContentFile propertyCompare = (ContentFile) obj;
      if (this.getId().longValue() == propertyCompare.getId().longValue()) {
         return true;
      }
      return false;
   }
}
